/*
 * Name: Event
 * Author: Sam Oakley
 * Date: 23/3/2010
 * Version Number: 1.0
 * Description: Displays DetailsActivity, DateActivity and LocationActivity in a tabbed pane.
 * Changes History: 
 * 1.0 Created class
 */
package com.blork.rag;

import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;

public class Event extends TabActivity{
	public void onCreate(Bundle savedInstanceState) {
	    super.onCreate(savedInstanceState);
	    setContentView(R.layout.event);

	    Resources res = getResources(); // Resource object to get Drawables
	    TabHost tabHost = getTabHost();  // The activity TabHost
	    TabHost.TabSpec spec;  // Resusable TabSpec for each tab
	    Intent intent;  // Reusable Intent for each tab
	    
	    
	    
	    Bundle extras = getIntent().getExtras(); 

	

	    intent = new Intent().setClass(this, DetailsActivity.class);
	    intent.putExtra("title", extras.getString("title"));
	    spec = tabHost.newTabSpec("details").setIndicator("Details",
	                      res.getDrawable(R.drawable.details))
	                  .setContent(intent);
	    tabHost.addTab(spec);


	    intent = new Intent().setClass(this, DateActivity.class);
	    intent.putExtra("title", extras.getString("title"));
	    spec = tabHost.newTabSpec("date").setIndicator("Date",
	                      res.getDrawable(R.drawable.date))
	                  .setContent(intent);
	    tabHost.addTab(spec);

	    intent = new Intent().setClass(this, LocationActivity.class);
	    intent.putExtra("title", extras.getString("title"));
	    spec = tabHost.newTabSpec("map").setIndicator("Map",
	                      res.getDrawable(R.drawable.map))
	                  .setContent(intent);
	    tabHost.addTab(spec);

	    tabHost.setCurrentTabByTag("details");
	}
}
